import dayjs from 'dayjs'
import 'dayjs/locale/zh-cn'
import utc from 'dayjs/plugin/utc'

const FORMAT_TIME_STRING = 'YYYY-MM-DD HH:mm:ss'
// 扩展utc
dayjs.extend(utc)

export function formatTimeStr(
  timeStamp: string,
  format: string = FORMAT_TIME_STRING
) {
  const formatTime = dayjs.utc(timeStamp).utcOffset(8).format(format)
  return formatTime
}
